package com.qyer.search.model.aggregation;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Created by tangzheng on 16/7/17.
 */
public class Prefer {

  @JsonProperty
  private int s_type_group;
  @JsonProperty
  private int s_type;

  public Prefer(int s_type_group, int s_type) {
    this.s_type_group = s_type_group;
    this.s_type = s_type;
  }

  public Prefer(int s_type_group) {
    this.s_type_group = s_type_group;
  }

  public int getS_type_group() {
    return s_type_group;
  }

  public void setS_type_group(int s_type_group) {
    this.s_type_group = s_type_group;
  }

  public int getS_type() {
    return s_type;
  }

  public void setS_type(int s_type) {
    this.s_type = s_type;
  }

  @Override public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    Prefer prefer = (Prefer) o;

    if (s_type_group != prefer.s_type_group)
      return false;
    return s_type == prefer.s_type;

  }

  @Override public int hashCode() {
    int result = s_type_group;
    result = 31 * result + s_type;
    return result;
  }

  @JsonIgnore
  public boolean isValid(){
    if((s_type_group>0))
      return true;
    return false;
  }

  @JsonIgnore
  public boolean isValidST(){
    if((s_type>0))
      return true;
    return false;
  }
}
